package compnents

import (
	_const "centerServer/const"
	"centerServer/utils"
	"crypto/md5"
	"encoding/hex"
	"strings"
)

// 签名检测
func CheckSign(args map[string]interface{}, signStr string) bool {
	var isOk bool = false
	formatSignStr := utils.FormatSign(args)
	formatSignStr += "&key=" + _const.SecureKey
	md5Ctx2 := md5.New()
	md5Ctx2.Write([]byte(formatSignStr))
	s1 := hex.EncodeToString(md5Ctx2.Sum(nil))
	sign := strings.ToUpper(s1) //签名
	if signStr == sign {
		isOk = true
	}
	return isOk
}
